﻿@model IEnumerable<TGIApp.Web.Models.SellTicketViewModelForIndex>
@{
    if (Model != null)
    { 
  
    <table>
        <tr>
            <th>
                ShowName
            </th>
            <th>
                ShowDateTime
            </th>
            <th>
                TicketTypeClassName
            </th>
            <th>
                AllottedTickets
            </th>
            <th>
                SoldTickets
            </th>
            <th>
                AvailableTickets
            </th>
            <th>
                No of Tickets to Sell
            </th>
            <th>
            </th>
        </tr>
        @{
        int i = 0;
        foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.ShowName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ShowDateTime)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.TicketTypeClassName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AllottedTickets)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.SoldTickets)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AvailableTickets)
                </td>
                <td>
                    @*@Html.EditorFor(modelItem => item.NoOfTicketsToSell)*@
                    @Html.TextBox("NoOfTicketsToSell_" + (++i).ToString())
                </td>
                <td>
                    @Html.ActionLink("Sell", "Sell", new { AgentBranchId = item.AgentBranchId, TicketTypeId = item.TicketTypeId,ticketPrice = item.TicketPrice }, new { tag = "SellTag", name = "NoOfTicketsToSell_" + (i).ToString(), onclick = "myFunction(this)" })
                </td>
            </tr>
        }
        }
    </table>
    }
}
<script type="text/javascript">
    function myFunction( anchorTag) {
        //debugger;
        var txtBox = document.getElementById(anchorTag.name);
        var Qty = txtBox.value;
        anchorTag.href = anchorTag.href + '&SellQty=' + Qty;
    }

</script>
